#ifndef BILINGBLINGOUT_H
#define BILINGBLINGOUT_H

#include "cocos2d.h"

USING_NS_CC;


class BilingBlingOut : public CCNode
{
public:
	// 特效的播放方向
	enum {
		T2B,	// 上到下
		B2T,	// 下到上
		L2R,	// 左到右
		R2L,	// 右到左
		TL2BR,	// 左上到右下
		BR2TL,	// 右下到左上
		TR2LB,	// 右上到左下
		LB2TR	// 左下到右上
	};
	static BilingBlingOut*	create(const char* imgPath, const char* particleFile);
public:
	BilingBlingOut();
	~BilingBlingOut();
	bool			init(const char* imgPath, const char* particleFile, bool colorSample = true);
	void			start() {
		_started = true;
		this->scheduleUpdate();
	}

	inline void		setEndCall(CCObject* sender, SEL_CallFunc func) {
		_endCallSender = sender;
		_endCallFunc = func;
	}
	void 			update(float delta);
	void			setMethod(const int me);
	void			setSpeed(const long sp);
	void			reset();

public:
	int			_method;
	bool			_autoRemove;

protected:
	bool			toEnd();

protected:
	CCDrawNode*		_clipPolygon;
	CCImage*		_image;
	CCObject*		_endCallSender;
	SEL_CallFunc		_endCallFunc;
	bool			_started;
	long			_p1;
	long			_imgH;
	long			_imgW;
	long			_imgWH;
	const char*		_particleFile;
	long			_speed;
	bool			_colorSample;
};

#endif // BILINGBLINGOUT_H
